package tour.spring.bc.bo.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import tour.spring.bc.dao.ClientDao;
import tour.spring.bc.enums.UserRole;
import tour.spring.bc.model.Client;

@Service
public class ClientBoImpl {

	@Autowired
	ClientDao clientDao;
	
	public void saveClient(String name, String surname, String login, String password, String role){
		Client c = new Client();
		c.setName(name);
		c.setSurname(surname);
		c.setLogin(login);
		c.setPassword(password);
		c.setUserRole(UserRole.getByEnumName(role));
//		c.setUserRole(UserRole.ROLE_USER);
		clientDao.save(c);
	}
	
	public Client getClientByLogin(String login){
		return clientDao.getClientByLogin(login);
	}

	public ClientDao getClientDao() {
		return clientDao;
	}

	public void setClientDao(ClientDao clientDao) {
		this.clientDao = clientDao;
	}
	
	
}
